package com.fable.sp.core.widgets;

import com.fable.sp.core.annotation.RenderMode;
import com.fable.sp.core.widget.Preference;
import com.fable.sp.core.widget.RenderRequest;
import com.fable.sp.core.widget.RenderResponse;
import com.google.common.collect.Lists;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Component;

/**
 * .
 *
 * @author stormning on 16/8/30.
 */
@Component
public class SimpleSubmit extends SimpleWidget implements InitializingBean {

    @RenderMode(name = RENDER_MODE_PREFERENCE)
    public void preference(RenderRequest request, RenderResponse response) {

    }

    @RenderMode(name = RENDER_MODE_VIEW)
    public void view(RenderRequest request, RenderResponse response) {

    }

    @Override
    public void afterPropertiesSet() throws Exception {
        setInfo("提交按钮,供测试表单使用");
        setPreferences(Lists.newArrayList(new Preference("text", "按钮文字", "提交")));
        setCover("/webjars/widgets/images/submit.jpeg");
        setTags("按钮 测试");
        setTitle("简单提交表单按钮");
    }
}
